//go:build wireinject

package start

import (
	"forum/intr/adapter/driving/cache"
	"forum/intr/adapter/driving/dao"
	"forum/intr/adapter/driving/repo"
	"forum/intr/application"
	cache2 "forum/intr/domain/cache"
	repo2 "forum/intr/domain/repo"
	"github.com/google/wire"
)

// thirdPartySet 第三方依赖
var thirdPartySet = wire.NewSet(
	InitDB, InitCache,
	InitSaramaClient,
	InitSyncProducer,
)

// interactiveSvcSet 社交服务初始化
var interactiveSvcSet = wire.NewSet(
	wire.Bind(
		new(application.InteractiveService), new(*application.InteractiveServiceImp),
	),
	application.NewInteractiveServiceImp,
	wire.Bind(
		new(repo2.InteractiveRepository), new(*repo.InteractiveRepositoryImp),
	),
	repo.NewInteractiveRepositoryImp,
	wire.Bind(
		new(cache2.InteractiveCache), new(*cache.InteractiveRedisCache),
	),
	cache.NewInteractiveRedisCache,
	wire.Bind(
		new(dao.InteractiveDao), new(*dao.InteractiveMysqlDao),
	),
	dao.NewInteractiveMysqlDao,
)

func InitInteractiveService() application.InteractiveService {
	wire.Build(thirdPartySet, interactiveSvcSet)
	return new(application.InteractiveServiceImp)
}
